package com.zq.assistant.ui.main.adpter;

import android.content.Context;
import android.widget.ImageView;

import com.zq.assistant.R;
import com.zq.assistant.bean.FileInfo;
import com.zq.assistant.bean.ImageInfo;
import com.zq.assistant.ui.widget.recyclerview.adapter.CommonRecyclerAdapter;
import com.zq.assistant.ui.widget.recyclerview.RecyclerViewHolder;
import com.zq.assistant.utils.ImageLoadUtils;
import com.zq.assistant.utils.URLUtils;

import java.util.List;

/**
 * Created by zhangqiang on 17-5-10.
 */

public class FileExploreAdapter extends CommonRecyclerAdapter<FileInfo> {

    public FileExploreAdapter(List<FileInfo> dataList, Context context) {
        super(dataList, context, R.layout.item_file_info,R.layout.item_download_info,0);
    }

    @Override
    public void onBindContentViewHolder(RecyclerViewHolder holder, int position) {

        FileInfo fileBean = getDataAt(position);
        holder.setText(R.id.tv_name,fileBean.getName());

        ImageInfo imageInfo = fileBean.getIconInfo();

        ImageLoadUtils.displayImage(context, URLUtils.getImageURL(imageInfo == null ? null : imageInfo.getUrl()), (ImageView) holder.getView(R.id.iv_icon));
    }
}
